package com.sta.staff.service;

import com.sta.staff.mapper.MessageMapper;
import com.sta.staff.pojo.Message;
import com.sta.staff.pojo.Salary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageService {
    @Autowired
    private MessageMapper messageMapper;
    //查询所有留言
    public List<Message> find(){
        return messageMapper.findAllMessage();
    }
    //添加新留言
    public void add(Integer uid, Message message){
        messageMapper.insert(message);
        messageMapper.addUsersMessage(uid,message.getMid());
    }
    //删除员工留言
    public void delete(Integer mid){
        messageMapper.deleteUsersMessage(mid);
        messageMapper.deleteById(mid);
    }
}
